package com.etbsms.form;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import com.etbsms.domain.AgricultureAndFood;
import com.etbsms.domain.CodeCountry;
import com.etbsms.domain.CodeLanguage;
import com.etbsms.domain.CodePlant;
import com.etbsms.domain.Files;
import com.etbsms.domain.ResearchAndAnalysis;
import com.etbsms.domain.Users;

public class AgricultureAndFoodForm {
	
	public AgricultureAndFoodForm(){}
	
	public AgricultureAndFoodForm(Users users){
		this.users = users;
	}
	
	public AgricultureAndFoodForm(AgricultureAndFood form){
		this.seq_no = form.getSeq_no();
		this.rec_no = form.getRec_no();
		this.title_o = form.getTitle_o();
		this.title_c = form.getTitle_c();
		this.author = form.getAuthor();
		this.affiliation = form.getAffiliation();
		this.publisher = form.getPublisher();
		this.journal = form.getJournal();
		this.vol_page = form.getVol_page();
		this.year = form.getYear();
		this.codeLanguage = form.getLanguage();
		this.doc_type = form.getDoc_type();
		this.abstract_o = form.getAbstract_o();
		this.abstract_c = form.getAbstract_c();
		this.keyword_o = form.getKeyword_o();
		this.keyword_c = form.getKeyword_c();
		this.url = form.getUrl();
		
		if(form.getLanguage() != null)
			this.language = form.getLanguage().getCode();
		
		String _plant_code = "";
		String _plant_name_ch = "";
		
		for(CodePlant plant : form.getPlants()){
			_plant_name_ch += plant.getName_ch() + ",";		
			_plant_code += plant.getCode() + ",";
		}
		this.plants_code = _plant_code;
		this.plants_name_ch = _plant_name_ch;
		
		String _country_name_ch = "";
		String _country_code = "";
		for(CodeCountry country : form.getCountries()){
			_country_name_ch += country.getName_ch() + ",";		
			_country_code += country.getCode() + ",";		
		}
		this.countries_name_ch = _country_name_ch;	
		this.countries_code = _country_code;
				
		String _files = ",";
		for(Files files : form.getFiles())
			_files += files.getSeq_no() + ",";			
		this.files = _files;
		
//		this.original_number = form.getOriginal_number();
		this.clazz = form.getClazz();
		this.citation_title = form.getCitation_title();
		this.citation_author = form.getCitation_author();
		this.citation_source = form.getCitation_source();
		this.created = form.getCreated();
		this.updated = form.getUpdated();
		this.analyzed = form.isAnalyzed();
		this.flow = form.getFlow();
		
		this.codePlantSet = form.getPlants();
		this.codeCountrySet = form.getCountries();
		this.filesSet = form.getFiles();
		this.users = form.getUsers();
		this.literature = form.getLiterature();
		this.literature_desc = form.getLiterature_desc();
		this.researchAndAnalysis = form.getResearchAndAnalysis();
		
	}

	private int seq_no;
	private String rec_no;	
	private String title_o;	
	private String title_c;	
	private String author;	
	private String affiliation;				/** 作者服務機構**/
	private String publisher;					/** 出版機構**/
	private String journal;						/** 期刊名稱**/
	private String vol_page;	
	private Integer year;	
	private String language;	
	private String doc_type;	
	private String abstract_o;	
	private String abstract_c;	
	private String keyword_o;	
	private String keyword_c;	
	private String url;
	private String files;
	private String plants_code;	
	private String countries_name_ch;	
	private String countries_code;
	private String plants_name_ch;

	private Set<CodePlant> codePlantSet = new HashSet<CodePlant>();	
	private Set<CodeCountry> codeCountrySet = new HashSet<CodeCountry>();	
	private Set<Files> filesSet = new HashSet<Files>();	
	private String original_number;		/** 原文編號**/
	private String clazz;							/** 主題分類**/
	private String citation_title;			/** 被引標題**/
	private String citation_author;		/** 被引作者**/
	private String citation_source;		/** 被引出處**/	
	private Date created;
	private Date updated;
	private boolean analyzed;					/** 是否研析**/
	private Integer flow;
	private Users users;	
	private CodeLanguage codeLanguage;
	private boolean enabled = true;			//default = true
	private boolean locked = false;			//表單鎖定 default = false
	private boolean deleted = false;		//表單刪除
	private Users locked_user;
	private Date locked_time;
	private Users checker_user;
	
	private Integer literature;				/** 文獻性質 					2011/11/23 **/
	private String literature_desc;		/** 文獻性質_其它說明 2011/11/23 **/
	private ResearchAndAnalysis researchAndAnalysis;
	
	public int getSeq_no() {
		return seq_no;
	}
	public void setSeq_no(int seq_no) {
		this.seq_no = seq_no;
	}
	public String getRec_no() {
		return rec_no;
	}
	public void setRec_no(String rec_no) {
		this.rec_no = rec_no;
	}
	public String getTitle_o() {
		return title_o;
	}
	public void setTitle_o(String title_o) {
		this.title_o = title_o;
	}
	public String getTitle_c() {
		return title_c;
	}
	public void setTitle_c(String title_c) {
		this.title_c = title_c;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getAffiliation() {
		return affiliation;
	}
	public void setAffiliation(String affiliation) {
		this.affiliation = affiliation;
	}
	public String getPublisher() {
		return publisher;
	}
	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}
	public String getJournal() {
		return journal;
	}
	public void setJournal(String journal) {
		this.journal = journal;
	}
	public String getVol_page() {
		return vol_page;
	}
	public void setVol_page(String vol_page) {
		this.vol_page = vol_page;
	}
	public Integer getYear() {
		return year;
	}
	public void setYear(Integer year) {
		this.year = year;
	}
	public String getLanguage() {
		return language;
	}
	public void setLanguage(String language) {
		this.language = language;
	}
	public String getDoc_type() {
		return doc_type;
	}
	public void setDoc_type(String doc_type) {
		this.doc_type = doc_type;
	}
	public String getAbstract_o() {
		return abstract_o;
	}
	public void setAbstract_o(String abstract_o) {
		this.abstract_o = abstract_o;
	}
	public String getAbstract_c() {
		return abstract_c;
	}
	public void setAbstract_c(String abstract_c) {
		this.abstract_c = abstract_c;
	}
	public String getKeyword_o() {
		return keyword_o;
	}
	public void setKeyword_o(String keyword_o) {
		this.keyword_o = keyword_o;
	}
	public String getKeyword_c() {
		return keyword_c;
	}
	public void setKeyword_c(String keyword_c) {
		this.keyword_c = keyword_c;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getOriginal_number() {
		return original_number;
	}
	public void setOriginal_number(String original_number) {
		this.original_number = original_number;
	}
	public String getClazz() {
		return clazz;
	}
	public void setClazz(String clazz) {
		this.clazz = clazz;
	}
	public String getCitation_title() {
		return citation_title;
	}
	public void setCitation_title(String citation_title) {
		this.citation_title = citation_title;
	}
	public String getCitation_author() {
		return citation_author;
	}
	public void setCitation_author(String citation_author) {
		this.citation_author = citation_author;
	}
	public String getCitation_source() {
		return citation_source;
	}
	public void setCitation_source(String citation_source) {
		this.citation_source = citation_source;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public boolean isAnalyzed() {
		return analyzed;
	}
	public void setAnalyzed(boolean analyzed) {
		this.analyzed = analyzed;
	}
	public Users getUsers() {
		return users;
	}
	public void setUsers(Users users) {
		this.users = users;
	}

	public CodeLanguage getCodeLanguage() {
		return codeLanguage;
	}

	public void setCodeLanguage(CodeLanguage codeLanguage) {
		this.codeLanguage = codeLanguage;
	}

	public Integer getFlow() {
		return flow;
	}

	public void setFlow(Integer flow) {
		this.flow = flow;
	}

	public Set<CodePlant> getCodePlantSet() {
		return codePlantSet;
	}

	public void setCodePlantSet(Set<CodePlant> codePlantSet) {
		this.codePlantSet = codePlantSet;
	}

	public Set<CodeCountry> getCodeCountrySet() {
		return codeCountrySet;
	}

	public void setCodeCountrySet(Set<CodeCountry> codeCountrySet) {
		this.codeCountrySet = codeCountrySet;
	}

	public String getCountries_code() {
		return countries_code;
	}

	public void setCountries_code(String countries_code) {
		this.countries_code = countries_code;
	}

	public String getFiles() {
		return files;
	}

	public void setFiles(String files) {
		this.files = files;
	}

	public Set<Files> getFilesSet() {
		return filesSet;
	}

	public void setFilesSet(Set<Files> filesSet) {
		this.filesSet = filesSet;
	}
	public String getPlants_code() {
		return plants_code;
	}

	public void setPlants_code(String plants_code) {
		this.plants_code = plants_code;
	}

	public String getCountries_name_ch() {
		return countries_name_ch;
	}

	public void setCountries_name_ch(String countries_name_ch) {
		this.countries_name_ch = countries_name_ch;
	}

	public String getPlants_name_ch() {
		return plants_name_ch;
	}

	public void setPlants_name_ch(String plants_name_ch) {
		this.plants_name_ch = plants_name_ch;
	}

	public Date getUpdated() {
		return updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	public Users getLocked_user() {
		return locked_user;
	}

	public void setLocked_user(Users locked_user) {
		this.locked_user = locked_user;
	}

	public Date getLocked_time() {
		return locked_time;
	}

	public void setLocked_time(Date locked_time) {
		this.locked_time = locked_time;
	}

	public Users getChecker_user() {
		return checker_user;
	}

	public void setChecker_user(Users checker_user) {
		this.checker_user = checker_user;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
	
	public Integer getLiterature() {
		return literature;
	}

	public void setLiterature(Integer literature) {
		this.literature = literature;
	}

	public String getLiterature_desc() {
		return literature_desc;
	}

	public void setLiterature_desc(String literature_desc) {
		this.literature_desc = literature_desc;
	}

	public ResearchAndAnalysis getResearchAndAnalysis() {
		return researchAndAnalysis;
	}

	public void setResearchAndAnalysis(ResearchAndAnalysis researchAndAnalysis) {
		this.researchAndAnalysis = researchAndAnalysis;
	}
}
